import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': '/src'
    }
  },
  server: {
    port: 8080,
    https: false,
    host: '0.0.0.0',
    proxy: {
      '^/api': {
        target: 'http://127.0.0.1:9094/api', // 转发的目标服务器地址 
        changeOrigin: true, // 修改源地址为目标地址
        rewrite: path => path.replace(/^\/api/, '') // 修改请求路径为代理路径
      }
    }
  }
})
